<template>
  <div>
    <el-row>
      <el-col :span="22">
        <div class="sec-title">我的考试</div>
      </el-col>
    </el-row>
    <el-divider></el-divider>
    <el-form
      :inline="true"
      :model="formInline"
      class="demo-form-inline"
    >
      <el-form-item label="审批人">
        <el-input
          v-model="formInline.user"
          placeholder="审批人"
        ></el-input>
      </el-form-item>
      <el-form-item label="活动区域">
        <el-select
          v-model="formInline.region"
          placeholder="活动区域"
        >
          <el-option
            label="区域一"
            value="shanghai"
          ></el-option>
          <el-option
            label="区域二"
            value="beijing"
          ></el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button
          type="primary"
          @click="onSubmit"
        >查询</el-button>
      </el-form-item>
    </el-form>
    <el-table
      :data="papers"
      height="590"
    >
      <el-table-column
        prop="paperId"
        label="试卷编号"
      >
      </el-table-column>
      <el-table-column
        prop="paperName"
        label="试卷名称"
      >
      </el-table-column>
      <el-table-column
        prop="accountName"
        label="答题人"
      >
      </el-table-column>
      <el-table-column
        prop="totalScore"
        label="总分"
      >
      </el-table-column>
      <el-table-column
        prop="score"
        label="得分"
      >
      </el-table-column>
      <el-table-column
        prop="isWin"
        label="是否通过"
      >
        <template slot-scope="scope">
          <el-tag size="medium">{{ handWin(scope.row.isWin) }}</el-tag>
        </template>
      </el-table-column>
      <el-table-column label="操作">
        <template slot-scope="scope">
          <el-button
            @click="handleClick(scope.row)"
            type="text"
            size="small"
          >详情</el-button>
          <el-button
            type="text"
            size="small"
          >删除</el-button>
          <el-button
            type="text"
            size="small"
          >下载试卷</el-button>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination
      background
      layout="prev, pager, next"
      :total="1000"
    >
    </el-pagination>
  </div>
</template>

<script>
export default {
  data() {
    return {
      papers: [
        
      ],
      formInline: {
        user: "",
        region: "",
      },
    };
  },
  methods: {
    onSubmit() {
      console.log("submit!");
    },
    handWin(isWin) {
        return isWin ? '通过' : '未通过'
    }
  },
  async mounted() {
    const { data: response } = await this.$http.post('paper/query')
    if (response.code == 200) {
        this.papers = response.data
    }
  }
};
</script>

<style lang="css" scoped>
.sec-blue {
  color: #409eff;
}
.sec-title {
  font-size: 18px;
  font-weight: 700;
}
</style>